package com.xs.bookspoststation.AdminActivity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.xs.bookspoststation.BookActivity.OperateBookActivity;
import com.xs.bookspoststation.R;
import com.xs.bookspoststation.StudentActivity.OperateStudentActivity;
import com.xs.bookspoststation.UserActivity.MainActivity;
import com.xs.bookspoststation.UserActivity.OperateUserActivity;

public class AdminActivity extends AppCompatActivity {

    //定义对象
    private Button operateuser,operatestudent,operatebook,change,quit,checkbook;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin);

        //绑定控件
        //对用户登录信息的操作
        operateuser=(Button)findViewById(R.id.button1);
        //对学生基本信息的操作
        operatestudent=(Button)findViewById(R.id.button2);
        //对书籍信息的操作
        operatebook=(Button)findViewById(R.id.button6);
        //  退  出
        checkbook=(Button)findViewById(R.id.button3);
        //切换用户
        quit=(Button)findViewById(R.id.button4);
        //查看已被学生借取书籍
        change=(Button)findViewById(R.id.button5);

        //
        operateuser.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View arg0) {
                Intent intent=new Intent(AdminActivity.this, OperateUserActivity.class);
                Toast.makeText(getApplicationContext(), "跳转操作用户信息界面", Toast.LENGTH_LONG).show();
                startActivity(intent);
            }});

        operatestudent.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View arg0) {
                Intent intent=new Intent(AdminActivity.this, OperateStudentActivity.class);
                Toast.makeText(getApplicationContext(), "跳转操作学生信息界面", Toast.LENGTH_LONG).show();
                startActivity(intent);
            }});

        operatebook.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(AdminActivity.this, OperateBookActivity.class);
                Toast.makeText(getApplicationContext(), "跳转操作图书信息界面", Toast.LENGTH_LONG).show();
                startActivity(intent);
            }
        });

        change.setOnClickListener(new View.OnClickListener(){

            @Override
            public void onClick(View arg0) {
                Intent intent =new Intent(AdminActivity.this, MainActivity.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "切换用户", Toast.LENGTH_LONG).show();
            }});
        quit.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View arg0) {
                Intent intent =new Intent(AdminActivity.this,MainActivity.class);
                Toast.makeText(getApplicationContext(), "返回", Toast.LENGTH_LONG).show();
                startActivity(intent);
                finish();
            }});
        checkbook.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View arg0) {
//                Intent intent =new Intent(AdminActivity.this,BorrowBookViewActivity.class);
//                Toast.makeText(getApplicationContext(), "检查已借书籍", Toast.LENGTH_LONG).show();
//                startActivity(intent);
            }});

    }
}
